<?php
use app\components\Lcms;
use app\components\Fun;
//print_r($data);

    $json=[];
    $ki=0;
    foreach ($data as $label=>$vo) {
        $list=[];
        foreach ($vo as $key=>$val) {
            $list[]=[
                $key+1,
                $val
            ];
        }
        
        $json[]=[
            'data'=>$list,
            'label'=>$label,
            'color'=>$base->color($ki++)
        ];
    }
    $jsonstr=  json_encode($json);
 $jsonTimeArray=[0];
 foreach ($timeArray as $vo) {
    $jsonTimeArray[]=  \app\components\Fun::date($vo);
}
 /*
  print_r($timeArray);
  print_r($data);*/
  ?>
<link rel="stylesheet" href="<?= Lcms::getWeb() ?>public/lcms/charts/matrix-style.css" /> 
<script type="text/javascript" src="<?= Lcms::getWeb() ?>public/lcms/charts/jedate/jedate.js"></script>
<link type="text/css" rel="stylesheet" href="<?= Lcms::getWeb() ?>public/lcms/charts/jedate/skin/jedate.css">
<div class="span12">
    <div class="widget-box">
        <div class="widget-content">
            <div class="chart"></div>
        </div>
    </div>
    <div class="Controller">
        <form>
        <span class="spanbeginTime">开始时间:</span>
        <input type="text" id="beginTime" value="<?= Fun::date($base->beginTime) ?>" name="beginTime" />
        <span class="spanendTime">结束时间:</span>
        <input type="text" id="endTime" value="<?= Fun::date($base->endTime) ?>" name="endTime" />
        
        
        
        <span class="spanSegmentNum" title="把开始到结束的时间段分成几份">份数:</span>
        <input class="SegmentNum" id="SegmentNum" type="number" value="<?= $base->SegmentNum ?>" name="SegmentNum"/>
        <button type="button" title="自动出最合适的份数" onclick="autoCount()">计算份数</button>
        <input type="hidden" name="barmode" value="true" />
        <input type="submit" class="submit" value="提交"/>
        </form>
    </div>
    
</div>
<script>
 
  var Barchart={
      data:<?= $jsonstr ?>,
      max:<?= $base->getMax() ?>,
      min:<?= $base->getmin() ?>,
      timeArray:<?= json_encode($jsonTimeArray) ?>
  };
</script>
<script src="<?= Lcms::getWeb() ?>public/lcms/charts/jquery.flot.min.js"></script>  
<script src="<?= Lcms::getWeb() ?>public/lcms/charts/matrix.charts.js"></script>  